from pymongo import MongoClient

client = MongoClient('mongodb://localhost:27017/')
db = client['cookbook']
collection = db['cooks2']

if __name__ == '__main__':
    print(collection.count())
    for one in collection.find({}):
        pre_title = one['title']
        shards = collection.find({'title': pre_title})
        print(shards.count())
        # if shards.count() > 1:
        #     for shard in shards[1:]:
        #         print(shard['title'])
        # collection.delete_one({'title': shard['title']})
